<?php
extract(array(
	'columns' => 5,
	'class' => 'items-slider users-slider',
	'row_class' => 'products-row',
	'grid_class' => 'products-grid-%s',
), EXTR_SKIP);

if ( !empty($users) ) {

	$row_class .= ' ' . sprintf($grid_class, $columns);

	printf('<div class="%s">', $class);
	
	$count = 0;
	$total = count($users);
	foreach ($users as $user) {

		if ( $count == 0 || $count % $columns == 0 ) {
			printf('<div class="%s">', $row_class);
		}

		printf('<article class="product user">');

		$this->renderPartial('//common/image', array('pair' => $user->avatar, 'object_type' => 'user', 'width' => 135, 'height' => 135));
		printf('<h3 class="name"><a href="%s">%s</a></h3>', $user->profileUrl, userDisplayName($user));

		printf('</article>');


		$count++;

		if ( $count == $total || ($count) % $columns == 0 ) {
			printf('</div>');
		}

	}
	
	printf('</div>');

}